import requests
import numpy as np
from typing import ClassVar
from .config_load import app_config
from langchain_ollama import OllamaLLM
from langchain_openai import ChatOpenAI,OpenAIEmbeddings


class SILICONFLOWLLM():
    """
        初始化语言大模型
    """
    
    LLM_MODEL: ClassVar[str]        = app_config['siliconflow']['llm_model'] 
    API_URL: ClassVar[str]          = app_config['siliconflow']['base_url']
    API_KEY: ClassVar[str]          = app_config['siliconflow']['api_key']
    
    def __init__(self) -> None:
        self.llm_obj = ChatOpenAI(
            openai_api_base=self.API_URL,
            openai_api_key=self.API_KEY,  
            model_name=self.LLM_MODEL, 
        )

    def create_llm(self)-> object:

        return self.llm_obj



class QwenLLM():
    """
        初始化语言大模型
    """

    LLM_MODEL: ClassVar[str]        = app_config['aliyun']['llm_model'] 
    API_URL: ClassVar[str]          = app_config['aliyun']['base_url']
    API_KEY: ClassVar[str]          = app_config['aliyun']['api_key']

    def __init__(self) -> None:
        self.llm_obj = ChatOpenAI(
            openai_api_base=self.API_URL,
            openai_api_key=self.API_KEY,  
            model_name=self.LLM_MODEL, 
        )

    def create_llm(self)-> object:

        return self.llm_obj
    


class OllamaLLM():
    """
        初始化语言大模型
    """

    pass